using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableKillerDao:DaoBase<TableKiller>
    {
        public override void AddPrimaryIndex(TableKiller model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableKiller.txt";
        }

        protected override TableKiller ParseRowData(string[] rowData)
        {
            TableKiller data = new TableKiller();

            if (string.IsNullOrEmpty(rowData[0]))
            {
                data.id = 0;
            }
            else
            {
                data.id = int.Parse(rowData[0]);
            }

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.killNum = 0;
            }
            else
            {
                data.killNum = int.Parse(rowData[1]);
            }

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.colorR = 0;
            }
            else
            {
                data.colorR = int.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.colorG = 0;
            }
            else
            {
                data.colorG = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.colorB = 0;
            }
            else
            {
                data.colorB = int.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.jailFlag = 0;
            }
            else
            {
                data.jailFlag = int.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.jailTime = 0;
            }
            else
            {
                data.jailTime = int.Parse(rowData[6]);
            }

            return data;
        }



    }

}
